<?php
/**
 * IG_Model_DbTable
 *
 * @author mmxie
 * @copyright Copyright (c) 2009 Green Shore (http://www.iwgame.com)
 * @version $Id: Rowset.php 929 2011-10-27 07:52:50Z mmxie $
 */
class IG_Model_Rowset extends Zend_Db_Table_Rowset_Abstract
{
    protected function _loadAndReturnRow($position)
    {
        if (!isset($this->_data[$position])) {
            require_once 'Zend/Db/Table/Rowset/Exception.php';
            throw new Zend_Db_Table_Rowset_Exception("Data for provided position does not exist");
        }

        $class = str_replace('_Model_DbTable_', '_Model_', $this->_tableClass);
        if (!class_exists($class)) {
            throw new IG_Exception("类名不存在($class)");
        }

        // do we already have a row object for this position?
        if (empty($this->_rows[$position])) {
            $this->_rows[$position] = new $class($this->_data[$position]);
        }
        // return the row object
        return $this->_rows[$position];
    }
}
